<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTablePersons extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('persons', function (Blueprint $table) {
            $table->increments('id')->comment('主键ID');
            $table->string('real_name',10)->default('')->comment('真实姓名');
            $table->unsignedTinyInteger('age')->default('0')->comment('年龄');
            $table->enum('sex',['0','1','2'])->default('0')->comment('性别');
            $table->date('birthday')->default('2016-12-17')->comment('密码');
            $table->string('Nickname',32)->default('')->comment('用户昵称');
            $table->string('company')->default('')->comment('公司');
            $table->string('address')->default('')->comment('用户地址');
            $table->unsignedBigInteger('user_id')->default('0')->comment('users表外键');
            $table->rememberToken();
            $table->timestamps();

            $table->foreign('user_id')->references('id')->on('users');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('persons');
    }
}
